﻿<Page x:Class="CalligraphyEditor.DevStelePapers"
      xmlns:dxg="clr-namespace:DevExpress.Xpf.Grid;assembly=DevExpress.Xpf.Grid.v12.1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
	Title="DevStelePapers">

    <Grid>
        <dxg:GridControl Grid.Row="1"  Name="Gcl_StelePaper"  ItemsSource="{Binding}" >
            <dxg:GridControl.Columns>
                <dxg:GridColumn FieldName="Name" Header="名称" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings    TextWrapping="Wrap" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="T_Author.Name" Header="作者" ReadOnly="True"  AllowFocus="False"/>
                <dxg:GridColumn FieldName="T_StelePaper2.Name" Header="临自" ReadOnly="True"  AllowFocus="False"/>
                <dxg:GridColumn FieldName="DysnatID" Header="朝代" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:ComboBoxEditSettings Name="Cmb_Dynast" DisplayMember="Name" ValueMember="ID"/>
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="Year" Header="时间" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings  DisplayFormat="yyyy" Mask="yyyy" MaskType="DateTime" MaskUseAsDisplayFormat="True"/>
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="Loacation" Header="地点" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings    TextWrapping="Wrap" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn   Header="高（米）" FieldName="Height" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings Mask="f" MaskType="Numeric" MaskUseAsDisplayFormat="True"  HorizontalContentAlignment="Left"/>
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn   Header="宽（米）" FieldName="Width" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings Mask="f" MaskType="Numeric" MaskUseAsDisplayFormat="True"  HorizontalContentAlignment="Left" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                
                <dxg:GridColumn FieldName="Text" Header="内容" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings AcceptsReturn="True"   TextWrapping="Wrap"  />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="StyleID" Header="字体" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:ComboBoxEditSettings Name="Cmb_Style" DisplayMember="Name"  ValueMember="ID"/>
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="SubDescription" Header="简介" >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings   TextWrapping="Wrap" AcceptsReturn="True" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
                <dxg:GridColumn FieldName="Description" Header="介绍" Visible="False"  >
                    <dxg:GridColumn.EditSettings >
                        <dxe:TextEditSettings   TextWrapping="Wrap" AcceptsReturn="True" MaxLength="200" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>                
                <dxg:GridColumn   Header="图片" >
                    <dxg:GridColumn.CellTemplate>
                        <DataTemplate>
                            <Button  Click ="Button_Click_AddPhoto" MinHeight="40" MinWidth="40" >
                                <Image Margin="0,0,0,0"  Stretch="Uniform"   Source="{Binding Path=Data.Photo, Mode=OneWay}"  />
                            </Button>
                        </DataTemplate>
                    </dxg:GridColumn.CellTemplate>
                </dxg:GridColumn>
                <dxg:GridColumn   >
                    <dxg:GridColumn.CellTemplate>
                        <DataTemplate>
                            <Button  Click="Button_Click_Browse"  MinHeight="40" MinWidth="40" Content="查看" />
                        </DataTemplate>
                    </dxg:GridColumn.CellTemplate>
                </dxg:GridColumn>
            </dxg:GridControl.Columns>
            <dxg:GridControl.View>
                <dxg:CardView AllowEditing="True"  ShowGroupedColumns="True"  NavigationStyle="Cell" FixedSize="400" MinFixedSize="150" Name="view" CardHeaderDisplayMemberBinding="{Binding Path=Data.Name, RelativeSource={RelativeSource Self}}" CellValueChanged="view_CellValueChanged" />
            </dxg:GridControl.View>
        </dxg:GridControl>
    </Grid>
</Page>
